<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/fingerprint.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/jquery-1.10.1.min.js",CClientScript::POS_HEAD);
//Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/alert.js",CClientScript::POS_HEAD);


Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.core.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.widget.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.scroller.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.util.datetime.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.datetimebase.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.widget.ios.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.i18n.zh.js",CClientScript::POS_HEAD);




Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/css_mobile_layout.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/css_mobile_member.css");
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/alert.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/js_mobile_common_new.js",CClientScript::POS_HEAD);

?>
<!-- 登录 S -->
    <div class="page-account" id="tabLoginContent">
        <div class="title-logo"></div>
        <div class="tab-way-login mtab-title">
            <span tabindex="0" id="s">学生登录</span>
            <span tabindex="1" id="t">老师登录</span>
        </div>
        <div class="mtab-content">
            <div tabindex="0" id="s_div">
                <ul class="form-input">
                    <li class="vermsg" style="color:red;">
                        <input type="tel" placeholder="学号" id="s_code" mvalid="{ 'require' : { 'errorMessage' : '请输入学号' }, 'length' : { 'max' : '11', 'min' : '10', 'errorMessage' : '学号为10位' }, 'regex' : { 'expression' : '^[0-9][0-9]{10}$', 'errorMessage' : '学号不正确' } }"></input>
                       
                        <i id="sendedVercode" class="disable"></i>
                    </li>
                    <li class="vermsg">
                        <input type="text" placeholder="姓名" id="s_name" mvalid="{ 'require' : { 'errorMessage' : '姓名' } }"></input>
                    </li>
                </ul>

                <div class="btn-submit" style="background-color:blanchedalmond;" id="submit0">登录</div>

               
            </div>
            <div tabindex="1" id="t_div" style="display:none;">
                <ul class="form-input">
                    <li class="vermsg">
                        <input type="text" placeholder="工号" id="t_code" mvalid="{ 'require' : { 'errorMessage' : '工号' } }"></input>
                    </li>
                    <li class="vermsg">
                        <input type="text" placeholder="姓名" id="t_name" mvalid="{ 'require' : { 'errorMessage' : '请输入姓名' } }"></input>
                       
                    </li>
                </ul>

                <div class="btn-submit"  style="background-color:blanchedalmond;" id="submit1">登录</div>

              
            </div>
        </div>
    </div>
<!-- 登录 E -->
    <script type="text/javascript">
        (function () {
           $("#s").bind("click",function(){  
        	   $("#s_div").show();
        	   $("#t_div").hide();
            });
           $("#t").bind("click",function(){
        	   $("#s_div").hide();
        	   $("#t_div").show();  
            });
           $("#submit0").bind("click",function(){
				var s_code = $("#s_code").val();
				var s_name = $("#s_name").val();
				var tag =1;
				 $.ajax({
		                type: "POST",
		                url: '<?php echo Yii::app()->createUrl('index/ajaxLoginProduct') ?>',
		                data: {
		                    code:s_code,
		                    name:s_name,
		                    type:tag
		                },
		                dataType: "json",
		                success: function (data) {
		                    if (data) {
		                    	  alert("OK");
		                        if (data['status'] == 1) {
		                            localStorage["stroeUser"] = data['key'];
		                            alert("OK");
		                            <?php if($type==1){ ?>
		                            window.location.href='<?php echo Yii::app()->createUrl('user/index',array('openid'=>$openid)) ?>';
		                            <?php }else{ ?>
		                            window.location.href='<?php echo Yii::app()->createUrl('user/index',array('openid'=>$openid)) ?>';
		                            <?php } ?>
		                        } else {
		                            alert(data['message']);
		                            _this.css('background','#68c8c7');
		                            _this.html('立即登录');
		                            return false;
		                        }
		                    }
		                }
		            });
           });
           $("#submit1").bind("click",function(){
				var t_code = $("#t_code").val();
				var t_name = $("#t_name").val();
				var tag =2;
				 $.ajax({
		                type: "POST",
		                url: '<?php echo Yii::app()->createUrl('index/ajaxLoginProduct') ?>',
		                data: {
		                    code:t_code,
		                    name:t_name,
		                    type:tag
		                },
		                dataType: "json",
		                success: function (data) {
		                    if (data) {
		                    	  alert("OK");
		                        if (data['status'] == 1) {
		                            localStorage["stroeUser"] = data['key'];
		                            alert("OK");
		                            <?php if($type==1){ ?>	
		                            window.location.href='<?php echo Yii::app()->createUrl('user/member',array('openid'=>$openid)) ?>';
		                            <?php }else{ ?>
		                            window.location.href='<?php echo Yii::app()->createUrl('user/member',array('openid'=>$openid)) ?>';
		                            <?php } ?>
		                        } else {
		                            alert(data['message']);
		                            _this.css('background','#68c8c7');
		                            _this.html('立即登录');
		                            return false;
		                        }
		                    }
		                }
		            });
          });



        }());
    </script>